<template>
  <div class="container">
    <el-menu
        class="el-menu-vertical-demo"
        :default-active="path"
        router
        style="width: 170px;min-height: calc(100vh - 50px);">
    
       <el-menu-item v-if="!(store.isAdmin)" index="/home">书架</el-menu-item>
       <el-menu-item v-if="store.isAdmin" index="/book">图书列表</el-menu-item>
       <el-menu-item v-if="!(store.isAdmin)" index="/barrow">借阅记录</el-menu-item>
       <!-- <el-menu-item index="/person">个人中心</el-menu-item> -->
       <!-- <el-menu-item index="/scrap"  v-if="user.value.stu_name ==='管理员'">报废记录</el-menu-item> -->
       <!-- <el-menu-item index="/stock">库存管理</el-menu-item> -->
    </el-menu>
  </div>
</template>

<script setup>
import { useMainStore } from '../store';
import { ref, toRefs, onMounted } from 'vue'
import { useRoute } from 'vue-router'


// 获取路由信息
const route = useRoute()

const store = useMainStore()

// 声明响应式数据
const path = ref('')

// 赋值路径
onMounted(() => {
  path.value = route.path
})
</script>

<style scoped>
.container{
  /* background-color: #a08b72; */
}
</style>
